<?
ini_set('memory_limit', -1); // 메모리제한을 없엔다.
require_once 'xlsx/Classes/PHPExcel/IOFactory.php';  // 라이브러리 파일
$objReader = PHPExcel_IOFactory::createReader('Excel2007');

$file_nm = "files/20141030_112235_excel_2007.xlsx"; // 엑셀파일 위치

if( !file_exists( $file_nm ) ) {
	exit(0);
}

$worksheet_num = 1;
$objPHPExcel = $objReader->load($file_nm);

foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
	if( $worksheet_num > 1 ) break;

	echo $worksheet->getTitle() . "\r\n";
	$row_num = 0;

	foreach ($worksheet->getRowIterator() as $row) {

		$row_num++;

		if( $row_num == 1 ) continue;

		echo '  - Row number: ' . $row->getRowIndex() . "\r\n";

		$cellIterator = $row->getCellIterator();
		$cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set

		foreach ($cellIterator as $cell) {

			$cell_value = "";
			$cell_coordi = "";

			if (!is_null($cell)) {
				$cell_value = trim( $cell->getCalculatedValue() );
				$cell_coordi = $cell->getCoordinate();
			}
			echo iconv('utf-8', 'euc-kr', $cell_value) . "<BR>";
		}
	}
	
	$worksheet_num++;
}

?>
